# -*- encoding: utf-8 -*-
"""
@File    : K_sum_use.py
@Author  : lilong
@Time    : 2022/12/12 12:44 上午
"""

import numpy as np
import keras.backend as k

constant = np.array(
    [[1, 2, 3],
     [2, 2, 3],
     [3, 2, 3]]
)
con = np.array(
    [[1],
     [0],
     [0]]
)
print('constant:', constant)

constant = k.constant(constant, dtype='float32')
con = k.constant(con, dtype='float32')
m = constant * con
print('m:', m)
constant_sum = k.sum(m, axis=1, keepdims=True)
print('last:', k.eval(constant_sum))

n = k.dot(constant, constant)
print('n:', n)
